const Controller = require('egg').Controller;

class ProductController extends Controller {
  async index() {
    const { ctx } = this;
    const res = await ctx.service.product.index();
    ctx.body = res;
  }

  async create() {
    const { ctx } = this;
    ctx.render('addProduct.html');
  }

  async detail() {
    const { ctx } = this;
    const { id } = ctx.query;
    ctx.body = `id: ${id}`;
  }

  async detail2() {
    const { ctx } = this;
    const { id } = ctx.params;
    ctx.body = `id: ${id}`;
  }
}

module.exports = ProductController;